setGlobalOptions
The setGlobalOptions API updates the global configuration options.
// Set global options
const { setGlobalOptions } = viz;
setGlobalOptions(options);
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| options | RecursivePartial<GlobalOptions> | true | Partial global options object to merge with current settings |
Returns: void
globalOptions()
Retrieves the current global configuration.
const { globalOptions } = viz;
globalOptions()
Parameters: None
Returns: GlobalOptions - The current global configuration object
Global Options Type
interface GlobalOptions {
autoEmitRenderCompletedEvent: boolean;
autoResizeCanvas: boolean;
autoHandledXLSXDownload: boolean;
useRAF: boolean;
displayAs: DisplayAsOptions;
locale: LocaleOptions;
}
Configuration Properties
autoEmitRenderCompletedEvent
Automatically emits the 'RenderCompleted' event when chart rendering finishes if chart is created using the Muze library. This event should be manually emitted if the chart is created using a third party library.
Type: boolean
Default: true
setGlobalOptions({
autoEmitRenderCompletedEvent: true
});
autoResizeCanvas
Automatically resizes canvases to match their mount element's dimensions.
Type: boolean
Default: true
setGlobalOptions({
autoResizeCanvas: true
});
autoHandledXLSXDownload
Automatically handles XLSX download functionality.
Type: boolean
Default: true
setGlobalOptions({
autoHandledXLSXDownload: true
});
useRAF
Uses requestAnimationFrame instead of setTimeout for canvas rendering.
Type: boolean
Default: false
setGlobalOptions({
useRAF: true
});
displayAs
Configures display text options for chart elements.
Type: DisplayAsOptions
interface DisplayAsOptions {
invalidValue: string;
columns: {
[columnName: string]: string;
};
}
displayAs.invalidValue
Text displayed for invalid or null values.
Type: string
Default: '{Null}'
setGlobalOptions({
displayAs: {
invalidValue: 'N/A'
}
});
displayAs.columns
Custom display names for columns in charts.
Type: { [columnName: string]: string }
Default: {}
setGlobalOptions({
displayAs: {
columns: {
'sales_amount': 'Sales ($)',
'customer_count': 'Number of Customers',
'avg_order_value': 'Avg. Order Value'
}
}
});
locale
Localization and regional settings (Read-only).
Type: LocaleOptions
interface LocaleOptions {
primaryLocale: string;
currencyLocale: string;
quarterStartMonth: number;
timezone: string;
}
Note: Locale options are read-only and automatically set from the ThoughtSpot environment.
locale.primaryLocale
Primary locale identifier (e.g., 'en-US', 'fr-FR', 'ja-JP'). Used for general text, number, and date formatting.
locale.currencyLocale
Currency-specific locale identifier.
Falls back to primaryLocale if not specified.
locale.quarterStartMonth
Starting month for fiscal quarters (1-12, where 1 = January). Used for quarter-based date calculations.
locale.timezone
Session timezone identifier (e.g., 'America/New_York', 'Europe/London'). Used for displaying dates and times.